import fetch from '@/lib/http'
import Cookies from 'js-cookie'

var http = {}
//http://ss.yprhealth.com http://ss.yprhealth.com  http://ss.yprhealth.com  http://ss.yprhealth.com
let BASE_URL = 'http://ss.yprhealth.com/api/'

// post请求
http.post = (url, params) => {
  console.log(url, params)
  console.log(Cookies)
  params['token'] = Cookies.get('token')
  params['code'] = Cookies.get('code')
  console.log(!Cookies.get('token'))
  console.log(!Cookies.get('code'))
  if (!Cookies.get('token')) {
    params['token'] = ''
  }
  if (!Cookies.get('code')) {
    params['code'] = ''
  }

  // params.orgCode = FIDE_CREDIT_API_CONFIG.orgCode
  return fetch({
    url: BASE_URL + url,
    method: 'post',
    params
  })
}

// get请求
http.get = (url, params) => {

  return fetch({
    url: BASE_URL + url,
    method: 'get',
    params
  })
}

export {
  http
}
